array reduce associative array php

61

array reduce associative array php -

$assoc_arr = array_reduce($arr, function ($result, $item) {
    $result[$item['text']] = $item['id'];
    return $result;
}, array());

Comments

Submit
0 Comments